#include "app.h"

TaskHandle_t TaskHandler_LVGL;
TaskHandle_t TaskHandler_SENSOR;
TaskHandle_t TaskHandler_BUTTON;

void app_init(void)
{
    xSensorSemaphore = xSemaphoreCreateBinary();  // 创建二进制信号量
    configASSERT(xSensorSemaphore != NULL);       // 确保创建成功
    xSensorDataQueue = xQueueCreate(10, sizeof(aht21_data_t));
    configASSERT(xSensorDataQueue != NULL);  // 确保创建成功

    xButtonDataQueue = xQueueCreate(10, sizeof(mbutton_data_t)*2);
    configASSERT(xButtonDataQueue != NULL);  // 确保创建成功

    xTaskCreate(sensor_task,  "sensor_task", 1024,NULL,2,&TaskHandler_SENSOR);
    xTaskCreate(lvgl_task,    "lvgl_task",   1024,NULL,2,&TaskHandler_LVGL);
    xTaskCreate(button_task,  "button_task", 1024,NULL,2,&TaskHandler_BUTTON);
    vTaskStartScheduler();
}







